-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: Fix infer_dtype result for float with embedded pd.NA #61624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Just a question.
@@ -1086,10 +1086,7 @@ def convert_dtypes( | |||
elif ( | |||
infer_objects | |||
and input_array.dtype == object | |||
and ( | |||
isinstance(inferred_dtype, str) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be sure, this removal is unrelated to the other change here, is that right? That is, we can remove this line on main and it won't break any tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right. I tested it on my personal repo, and all TC passed. (heoh#7)
At the time of writing the commit, I simply judged it as unnecessary code and removed it.
However, after seeing your question, I took a second look at the convert_dtypes()
function. It exists for the integer
and boolean
cases as well, and I felt that it was intended to explicitly indicate that the inferred_dtype
is of type str
.
(Previous work: #50094 a4c409e)
Even though the test passes without it, I don't understand pandas well enough yet to anticipate the side effects. For now, I think it's safer to respect the existing code style, so I added it back.(ddd7e3b)
Please feel free to let me know if I need to make any corrections again. Thanks for the review.
doc/source/whatsnew/v3.0.0.rst
file if fixing a bug or adding a new feature.Description
Fix a bug in :func:
api.types.infer_dtype
returning "mixed-integer-float" for float andpd.NA
mix.Cause
This problem occurred because the existing
is_float_array
internally fixedskipna=False
. It was solved by adding theskipna
argument.